package com.fesine.ch01.lesson04;

/**
 * 自定义线程中的实例变量，针对其他线程可以有共享与不共享之分
 * 演示数据不共享
 * Created by Fesine on 2016/6/26.
 */
public class MyThread extends Thread {
    private int count = 5;

    public MyThread(String name) {
        super();
        this.setName(name);
    }

    //数据不共享
    @Override
    public void run() {
        super.run();
        while (count > 0) {
            count --;
            System.out.println("由 " + this.currentThread().getName() + "计算，count=" + count);
        }
    }

}
